/*
 * @Description:离线恢复数据详情
 * @Author: Zzt
 * @Date: 2022-08-18 15:27:16
 * @LastEditTime: 2022-08-18 16:46:45
 */
import { Button, Form, Input, Modal, Table } from 'antd';
import Column from 'antd/es/table/Column';
import { useEffect } from 'react';

const Offline = (props: any) => {
  const { visible, data, onClose } = props;
  const [form] = Form.useForm();
  data.recoveryType = '离线恢复';
  useEffect(() => {
    form.setFieldsValue(data);
  }, [visible]);
  const submitFunc = () => {
    form.submit();
    onClose();
  };
  const handleCancel = () => {
    onClose();
  };
  return (
    <>
      <Modal
        visible={visible}
        title="恢复数据详情"
        // onOk={handleOk}
        onCancel={handleCancel}
        width={700}
        footer={[
          <Button
            key="yes"
            type="primary"
            onClick={() => {
              submitFunc();
            }}
          >
            终止备份
          </Button>,
          <Button key="close" onClick={onClose}>
            取消
          </Button>
          // <Button key="createAdd" type="primary">创建并添加档案</Button>,
        ]}
      >
        <Form form={form} size="small">
          <Form.Item label="档案类型" name="archivesType">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="恢复到库" name="recoveryScope">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="恢复类型" name="recoveryType">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          {/* <Form.Item label="计划名称" name="planName">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item> */}
          <Form.Item label="恢复节点" name="backupNode">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="恢复方式" name="recoveryMethod">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="离线数据包" name="recoveryMethod">
            <Table>
              <Column title="序号" dataIndex="id" key="id" align="center" />
              <Column title="文件名称" dataIndex="name" key="name" align="center" />
              <Column title="文件大小" dataIndex="size" key="size" align="center" />
            </Table>
          </Form.Item>
          <Form.Item label="数据恢复状态" name="state">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="恢复开始时间" name="startTime">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="恢复完成时间" name="finishTime">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="处理人" name="Handler">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
          <Form.Item label="恢复备注" name="remake">
            <Input bordered={false} disabled={true}></Input>
          </Form.Item>
        </Form>
      </Modal>
    </>
  );
};
export default Offline;
